﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ListDepartment.ascx.cs" Inherits="Pantry.Web.Users.Controls.ListDepartment" %>
<%@ Register TagPrefix="cc1" Namespace="SiteUtils" Assembly="CollectionPager" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="CollectionPager" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="LinkGroupAll" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="LinkGroup0" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="LinkGroup1" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="LinkGroup2" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="LinkGroup3" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="LinkGroup4" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="LinkGroup5" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="LinkGroup6" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="CheckBoxIncludeActivate" EventName="CheckedChanged" />
            <asp:AsyncPostBackTrigger ControlID="RepeaterListDepartment" EventName="ItemCommand" />
        </Triggers>
        <ContentTemplate>
            <div class="dtBottom">
                <div class="dtPagination more" style="float:left;margin-left:-15px;">
                    <div class="dataTables_paginate paging_full_numbers" id="DataTables_Table_0_paginate">
                        <span><asp:LinkButton ID="LinkGroupAll" Text="All" runat="server" OnClick="LinkGroupAllClick"></asp:LinkButton></span> 
                        <span><asp:LinkButton ID="LinkGroup0" Text="0-9" runat="server" OnClick="LinkGroup0Click"></asp:LinkButton></span> 
                        <span><asp:LinkButton ID="LinkGroup1" Text="A B C D E" runat="server" OnClick="LinkGroup1Click"></asp:LinkButton></span> 
                        <span><asp:LinkButton ID="LinkGroup2" Text="F G H I J" runat="server" OnClick="LinkGroup2Click"></asp:LinkButton></span> 
                        <span><asp:LinkButton ID="LinkGroup3" Text="K L M N" runat="server" OnClick="LinkGroup3Click"></asp:LinkButton></span> 
                        <span><asp:LinkButton ID="LinkGroup4" Text="O P Q R" runat="server" OnClick="LinkGroup4Click"></asp:LinkButton></span> 
                        <span><asp:LinkButton ID="LinkGroup5" Text="S T U V" runat="server" OnClick="LinkGroup5Click"></asp:LinkButton></span> 
                        <span><asp:LinkButton ID="LinkGroup6" Text="W X Y Z" runat="server" OnClick="LinkGroup6Click"></asp:LinkButton></span> 
                    </div>
                </div>
                <div class="active-panel">
                    <asp:CheckBox ID="CheckBoxIncludeActivate" runat="server" CssClass="simple_form abc" AutoPostBack="True" Checked="true" OnCheckedChanged="CheckBoxIncludeActivateChanged"/><label class="simple_form" for="CheckBoxIncludeActivate"> Include in-active</label>
                </div>
                <asp:Button ID="ButtonCreate" Text="Create" runat="server" OnClick="ButtonCreateClick" CssClass="buttonCreateDepartment"></asp:Button>
            </div>
            <div style="clear: both;"></div>
            <div class="widget_contents noPadding">
                <table class="tables">
                    <thead>
                        <tr>
                            <th>
                                Department Name
                            </th>
                            <th>
                                Address Line 1
                            </th>
                            <th>
                                Postcode
                            </th >
                            <th>
                                Contact
                            </th>
                            <th>
                                Is Active
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <asp:Repeater ID="RepeaterListDepartment" runat="server" OnItemCommand="MarkActivated">
                            <ItemTemplate>
                                <tr>
                                    <td visible="false">
                                        <asp:HiddenField ID="HiddenFieldDepartmentId" runat="server" Value='<%# String.Format("{0}${1}",Eval("DepartmentId"),Eval("DirectorateId")) %>' />
                                        <asp:LinkButton ID="LinkButton1" runat="server" Visible='<%#Eval("IsActivated").Equals("Yes")? true : false %>'><%#Eval("DepartmentName")%></asp:LinkButton>
                                        <asp:LinkButton ID="LinkButton2" runat="server" Visible='<%#Eval("IsActivated").Equals("No")? true : false %>' OnClientClick="return confirm('Do you want to make this Department active?');" CommandName="update"><%#Eval("DepartmentName")%></asp:LinkButton>
                                    </td>
                                    <td>
                                        <%#Eval("AddressLine1") %>
                                    </td>
                                    <td>
                                        <%#Eval("Postcode") %>
                                    </td>
                                    <td>
                                        <%#Eval("ContactName") %>
                                    </td>
                                    <td>
                                        <%#Eval("IsActivated") %>
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                </table>
                <div class="dtBottom">
                    <div class="dtInfo">
                        <%--<div class="dataTables_info" id="DataTables_Table_0_info">
                            Showing 1 to 10 of 10 entries</div>--%>
                    </div>
                    <div class="dtPagination">
                        <CC1:COLLECTIONPAGER id="CollectionPager" runat="server" 
                            HideOnSinglePage="false" BackText="Back" FirstText="First" ShowLabel="False" 
                            ShowFirstLast="False" NextText="Next" ResultsLocation="None" LastText="Last"
                            PageNumbersSeparator=" " PagingMode="PostBack" BackNextLocation="Split">
                        </CC1:COLLECTIONPAGER>
                    </div>
                </div>
            </div>
            <%--<a href="#" class="showmessage hasheader"></a>--%>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="loading">
                <div class="icon-load">
                    <img src="Resources/images/Icons/Load/load-108.gif" />
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <%--<div class="dialog DialogConfirm" title="Confirmation"><span class="label lwParagraph">Do you want to make this Department active?</span></div>--%>